I asked this recently but it was at the end of a very old thread so I don't think it had much visibility. VBS: This two-liner VBS script will maximize the window it is run from (e.g. double click this VBS file in explorer, and that explorer window maximizes):
Set oShell = CreateObject("WScript.Shell")
oShell.SendKeys "% x"
But I am at a loss on how I could get a DXL script to execute such a VBS. I tried Mathias's createShell() function (from shell.inc), but I just couldn't get that to work (createShell() already uses WScript.Shell). Any ideas out there on how to do this? strathglass - Tue Apr 16 08:43:52 EDT 2019 |
Re: Execute VBS script from DXL? (for window maximization) Could this be useful?
void shellSendKeys(string keys)
{
OleAutoObj shll = oleCreateAutoObject("Wscript.Shell")
if ( null shll ) return
OleAutoArgs args = create
put(args, keys)
oleMethod(shll, "SendKeys", args)
delete args
oleCloseAutoObject shll
}
shellSendKeys("% x")
|
Re: Execute VBS script from DXL? (for window maximization) Hey thanks! That pretty much seems to work! (Just a few unexplained anomalies, but only if script did nothing else. Hmm)
|
Re: Execute VBS script from DXL? (for window maximization) Well here is an issue still: If I have some code like this (where I put the above code in a function "maximizeWindow__T()"): realize(dbDoIt,100,1) bringToFront(current Module) maximizeWindow__T() setFocus(dbeSearchValue) show dbDoIt ...it has no effect. If I insert a statement like "infoBox("test")" before the maximizeWindow__T() function, then it has an effect...it makes the dialog box window full screen, instead of the module window!!
I wonder if there is a way to make the action happen on the module window? |
Re: Execute VBS script from DXL? (for window maximization) strathglass - Tue Apr 16 10:17:41 EDT 2019 Well here is an issue still: If I have some code like this (where I put the above code in a function "maximizeWindow__T()"): realize(dbDoIt,100,1) bringToFront(current Module) maximizeWindow__T() setFocus(dbeSearchValue) show dbDoIt ...it has no effect. If I insert a statement like "infoBox("test")" before the maximizeWindow__T() function, then it has an effect...it makes the dialog box window full screen, instead of the module window!!
I wonder if there is a way to make the action happen on the module window? The SendKeys command mimics keyboard action. %=ALT so what you are doing is the equivalent of pressing ALT+SPACE+x. That combination of keys maximizes the active window. So what you need to do is to make the module window active. Here is a suggestion:
Module m = current
read(fullName m) // Make the module window active
void shellSendKeys(string keys)
{
OleAutoObj shll = oleCreateAutoObject("Wscript.Shell")
if ( null shll ) return
OleAutoArgs args = create
put(args, keys)
oleMethod(shll, "SendKeys", args)
delete args
oleCloseAutoObject shll
}
shellSendKeys("% x")
|